package PeterSheep;

import PeterSheep.AccountsManage.UactCommand;
import PeterSheep.IndependentEvents.UAccountEvents;
import PeterSheep.StorageCenters.UBPlayerStorage;
import PeterSheep.Utils.CNullCommandCompleter;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;

//////////////////////////////////////////////////
//             Systems Description              //
// -------------------------------------------- //
// [1] CWM:                                     //
//      Command warning manager;                //
//      Usage: Print command Errors;            //
//                                              //
// [2] UACT:                                    //
//      User accounts Manager;                  //
//      Usage: Manage your accounts;            //
//////////////////////////////////////////////////

public final class Kernel extends JavaPlugin {

    public static String pluginResourceFolder;
    public static FileConfiguration pluginConfig;

    public static final UBPlayerStorage userAccountsList = new UBPlayerStorage();

    @Override
    public void onEnable() {
        // Plugin startup logic
        Bukkit.getLogger().info(" (PeterSheep) ==> Prepare Peter-Sheep Engine... ");
        Bukkit.getLogger().info(" (PeterSheep) --[@]> Read config files... ");
        saveDefaultConfig();

        Bukkit.getLogger().info(" (PeterSheep) --[@]> Getting using data from Server Client");
        Bukkit.getLogger().info(" (PeterSheep) --[|]> Resource data read from: "+getDataFolder().toPath().toString());
        pluginResourceFolder = getDataFolder().toPath().toString();
        Bukkit.getLogger().info(" (PeterSheep) --[|]> Configuration data is Collected!");
        pluginConfig = getConfig();

        Bukkit.getLogger().info(" (PeterSheep) --[@]> Register commands... ");
        Bukkit.getLogger().info(" (PeterSheep) --[|]> Registering [uact] Command... ");
        getCommand("uact").setExecutor(new UactCommand());
        getCommand("uact").setTabCompleter(new CNullCommandCompleter());
        Bukkit.getLogger().info(" (PeterSheep) --[@]> Register commands Completed! ");
        Bukkit.getLogger().info(" (PeterSheep) --[@]> Register events... ");
        Bukkit.getLogger().info(" (PeterSheep) --[|]> Registering [UAccount] Events... ");
        getServer().getPluginManager().registerEvents(new UAccountEvents(), this);
        Bukkit.getLogger().info(" (PeterSheep) --[@]> Register events Completed!");
        Bukkit.getLogger().info(" (PeterSheep) ==> Peter-Sheep Engine prepare Completed!");

    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}